<extend name="common/layouts"/>


<block name="content">

    <div class="kt-portlet">
        <div class="kt-portlet__head">
            <div class="kt-portlet__head-label">
                <h3 class="kt-portlet__head-title">
                    签到
                </h3>
            </div>
        </div>
        <div class="kt-portlet__body">
            <if condition="$isSign == 0 ">
                <h1>今日未签到
                    <button class="btn btn-success" id="submit">签到</button>
                </h1>
                <else />
                <h1>今日已签到
                </h1>
            </if>

            <!--begin::Section-->
            <div class="kt-section">
                <div class="kt-section__content">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>签到时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <foreach name="list" item="vo">
                            <tr>
                                <th>{$vo['id']}</th>
                                <td>{$vo['create_time']|date="Y-m-d H:i:s",###}</td>
                            </tr>
                        </foreach>

                        </tbody>

                    </table>
                </div>
            </div>

            <div class="ck-paginate font-weight-bold kt-font-lg kt-font-regular">
                {$page}
            </div>
            <!--end::Section-->


        </div>

        <!--end::Form-->
    </div>
</block>


<block name="js">
    <script>
        $('#submit').click(function () {
            $.ajax({
                url: '/home/signin/sign',
                dataType: 'json',
                type: 'post',
                success: function (result) {
                    if (result.code == 0) {
                        toastr.success("签到成功");
                        window.history.go(-1);
                    } else {
                        toastr.error(result.msg);
                        return;
                    }
                }
            })
        })

    </script>
</block>